(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('waf.popup.authenWizard22Controller', authenWizard22Controller);
	authenWizard22Controller.$inject = [ '$scope', '$q', '$uibModalInstance', 'Constants', 'dialogsModule', 'modalService', 'layoutConfig', 'validatorConfig', 'authService' ];
	function authenWizard22Controller($scope, $q, $uibModalInstance, Constants, dialogsModule, modalService, layoutConfig, validatorConfig, authService) {
		var ctrl = this, log = $scope.loggerFactory.getLogger("authenWizard1Popup");
		ctrl.dialogsModule = dialogsModule;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		
		ctrl.ok = function() {
			if (!dialogsModule.btnCallback || !dialogsModule.btnCallback['ok'] || dialogsModule.btnCallback['ok'](ctrl.enrollment) !== false) {
				$uibModalInstance.close();
			}
		};
		
		ctrl.close = function() {
			if (!dialogsModule.btnCallback || !dialogsModule.btnCallback['close'] || dialogsModule.btnCallback['close']() !== false) {
				$uibModalInstance.dismiss();
			}
		};
		
		ctrl.init = function() {
			authService.authenWizard22().then(function(response) {
				ctrl.enrollment = response.data.enrollment;
				ctrl.question = response.data.question;
			});
		};

	}
})(angular);